var ValidateFormTips = new Class({
	initialize: function (form, options){
		// in FormValidator.js
		
		new FormValidator(form, {
			onFormValidate: function(passed, form, event) {
				if (passed) {
					// here goes ajax submit
				}
				else {
					event.preventDefault();
				}
			},
			
			onElementValidate: function(isValid, field, className, warn){
				var label = $(getLabel(field));
				isValid ?
					label.removeClass("validation-failed") :
					label.addClass("validation-failed");
			},
			
			onElementPass: function (field){/* si controle OK*/
				field.set('title', "");
			},
			onElementFail: function (field, validatorsFailed){/* si controle KO*/
				field.set('title', FormValidator.getValidator(validatorsFailed[0]).getError(field));
			},
			scrollToErrorsOnSubmit: false
		});
	}
});
Moodule.register("ValidateFormTips", "form.toValidateTips");
